/******************************************************************************/
/*  Class PACKET                                                              */
/*  PO: S. Maslyakov, rusoil.9@gmail.com                                      */
/*                                                                            */
/*  Revision:     1.0                                                         */
/*  Date:         2011/02/20 14:55:33                                         */
/******************************************************************************/



#ifndef __PACKET_H
#define __PACKET_H


#include "data_types.h"
#include "Packet\packet_def.h"


//==============================================================================
//  Class PACKET
//==============================================================================
class PACKET
{
public:
  static void Init_Packet();
  static void Init_packet_task();
  static void Activate_packet_task();
  static void TimerRoutine();
  static void SendUrgentPacket();

private:
  static void Init_rtos_part();
  static void Task_packet(void * par);
  static void ConvertSignData(const uint32_t _type, __UNION_DWORD * const _pData);
  static void MakePacket();
  static void ReloadTimer();
  static void SetLastSendingTime();
  static bool_t ReadArg(const void * const _pData);
  static uint32_t GetDataSize(const uint32_t _dataType);
  static sint32_t GetExpectedLen(const __CELL_SETT_PACKET * const _pRec);
  static uint32_t ReadRec(__CELL_SETT_PACKET * const _pRec, const uint32_t _index);
  static sint32_t AddHeader(int8_t * const _pBuff);
  static sint32_t AddEnd(int8_t * const _pBuff);
  static sint32_t AddData(int8_t * const _pBuff, const __CELL_SETT_PACKET * const _pRec);
  static sint32_t SendData(const __DATA_PACK * const _pData);
  static sint32_t Connect();
  static sint32_t Disconnect();

  static uint32_t m_timer;
};
//==============================================================================
//==============================================================================


#endif